<template>
	<view class="wrapper tuanDui f28">
		<div class="center item" @click="makePhone(district.phone)">
			<div class="flex1">街道办电话</div>
			<div> {{district.phone}}</div>
			<image src="../../../static/shouye/tu1.png" mode="widthFix" class="phone-icon ml20"></image>
		</div>
		<div class="center item" @click="makePhone(community.phone)">
			<div class="flex1">北门口社区电话</div>
			<div>{{community.phone}}</div>
			<image src="../../../static/shouye/tu1.png" mode="widthFix" class="phone-icon ml20"></image>
		</div>
		<div class="input-box center mt20">
			<input type="text" class="flex1 f28" placeholder="请输入关键词" placeholder-class="c999" v-model="name"
			  @confirm="getlist"/>
			<div class="btheme center" @click="getlist">
				<image src="../../../static/shouye/tu2.png" mode="widthFix" class="search-icon"></image>
			</div>
		</div>
		<div class="box bfff posr mt40" @click="open('./xiangXi?id='+v.id)" v-for="(v,i) in list" :key="v.id">
			<div class="posa"></div>
			<div class="ctheme flex-start">
				<div class="mr40">{{i+1}}</div>
				<div>{{v.name}}</div>
			</div>
			<div class="c9b u-line-2">{{v.introduce}}</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				district:'',
				community:'',
				list:[],
				name:''
			}
		},
		onLoad(){
			this.getdistrict()
			this.getcommunity()
			this.getlist()
		},
		methods: {
			getlist(){
				this.$http('/applet/team/list').then(r => {
					console.log(r)
					this.list=r.filter(v =>{
						return v.name.indexOf(this.name)!=-1 && v.isDisplay==true
					})
				})
			}, 
			// 打电话
			makePhone(phoneNumber){
				uni.makePhoneCall({
					phoneNumber
				});

			},
			// 社区查询
			getcommunity(){
				this.$http('/applet/phone/community').then(r => {
					this.community = r
				})
			},
			// 街道办查询
			getdistrict(){
				this.$http('/applet/phone/district').then(r => {
					this.district = r
				})
			}
		}
	}
</script>

<style lang="scss">
	.box{
		width: 670rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0,0,0,0.16);
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		padding: 28rpx 40rpx 24rpx;
		.c9b{
			padding-top: 20rpx;
			margin-top: 20rpx;
			border-top: 1px solid #EBEBEB;
		}
		.posa{
			width: 12rpx;
			height: 30rpx;
			background: #0077FF;
			border-radius: 0rpx 8rpx 8rpx 0rpx;
			left: 0;
			top: 34rpx;
		}
	}
	.input-box {
		width: 672rpx;
		height: 74rpx;
		background: #FFFFFF;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		padding-left: 22rpx;
		border: 2rpx solid #E6E6E6;
		.search-icon{
			width: 37rpx;
			height: 37rpx;
		}
		.btheme {
			width: 96rpx;
			height: 74rpx;
			background: linear-gradient(180deg, #1078FF 0%, #62A4FE 100%);
			border-radius: 0rpx 12rpx 12rpx 0rpx;
		}
	}

	.item {
		padding: 20rpx 0;
		&:first-of-type{
			border-bottom: 1rpx solid #EBEBEB;
		}

		.phone-icon {
			width: 40.03rpx;
			height: 40.03rpx;
		}
	}

	.tuanDui {
		padding: 20rpx 40rpx;
	}
</style>